<%
# Copyright (C) 2013 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

  <div class="desc">
    <h3><%= t 'attempt_history', 'Attempt History' %></h3>
  </div>
  <table class="ic-Table ic-Table--condensed" summary="{{#t}}A table that shows your quiz attempt history. Each attempt is on the left side. The attempt, time, and score are across the top.{{/t}}">
    <thead>
      <tr>
        <td></td>
        <th scope="col"><%= t 'attempt', 'Attempt' %></th>
        <th  scope="col"><%= t 'time', 'Time' %></th>
        <th scope="col"><%= t 'score', 'Score' %></th>
        <% if submission_has_regrade?(@submission) %>
        <th  scope="col" class="regraded"><%= t 'regraded', 'Regraded' %></th>
        <% end %>
      </tr>
    </thead>

    <tbody>
      <% if @versions.size > 1 %>
        <% version, index = @versions.reverse.each_with_index.detect {|k, v| k.score == @submission.kept_score } %>
        <% if version %>
          {{> views/submission_version}}
        <% end %>
      <% end %>

      <% (@versions.reverse!).each_with_index do |version, index| %>
        {{> views/submission_version}}
      <% end %>
    </tbody>
  </table>

  <% if @versions.detect {|v| v.pending_review? } %>
  <p class="submission-pending-review">
    <em>*</em> <%= t 'questions_not_graded', 'Some questions not yet graded' %>
  </p>
  <% end %>
